<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>symbol的基本使用</title>
</head>
<body>
  
  <script>
    const s1 = Symbol()
    console.log(s1)
    
    const s2 = Symbol()
    console.log(s2)

    const obj1 = {
      [s1]: "aaa",
      [s2]: "bbb"
    }

    console.log(obj1)
    console.log(Object.keys(obj1))
    console.log(Object.getOwnPropertySymbols(obj1))

    for (const key of Object.getOwnPropertySymbols(obj1)) {
      console.log(key)
    }

    const ss1 = Symbol.for("123")
    const ss2 = Symbol.for("123")
    console.log(ss1 == ss2)
  </script>
</body>
</html>